package com.gxa.www.cl.common.base;

/**
 * 自定义一个支持layui格式的返回对象
 */
public class LayuiRespResult<T> {
    private Integer code;
    private String msg;
    private Integer count;
    private T data;

    public LayuiRespResult() {
    }

    public LayuiRespResult(Integer code) {
        this.code = code;
    }

    public LayuiRespResult(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static <T> LayuiRespResult<T> success(Integer count, T data) {
        LayuiRespResult<T> lar = new LayuiRespResult<T>(RespResultCode.OK.getCode(),RespResultCode.OK.getMessage());
        lar.setCount(count);
        lar.setData(data);
        return lar;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
